package cn.airia.as3wplib.service
{
	/**
	 * @author S.Momoko
	 * date : 2009-07-02
	 * interfaces of wordpress's xml-rpc
	 */ 
	public interface IWordPressService
	{
		/**
		 * Retrieve the blogs of the users
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>boolean isAdmin</li>
		 * <li>string url</li>
		 * <li>int blogid </li>
		 * <li>string blogName</li>
		 * <li>string xmlrpc </li>
		 * </ul>
		 */		
		function getUsersBlogs(username:String,password:String,retFun:Function):void;
		
		/**
		 * Get list of all tags. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>int tag_id</li>
		 * <li>string name</li>
		 * <li>int count</li>
		 * <li>string slug</li>
		 * <li>string html_url</li>
		 * <li>string rss_url</li>
		 * </ul>
		 */		
		function getTags(blog_id:int,username:String,password:String,retFun:Function):void;
		/**
		 * Retrieve comment count for a specific post.
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param post_id 
		 * @param retFun Object
		 * <ul>
		 * <li>string approved</li>
		 * <li>int awaiting_moderation</li>
		 * <li>int spam</li>
		 * <li>int total_comments</li>
		 * </ul>
		 */
		function getCommentCount(blog_id:int,username:String,password:String,post_id:int,retFun:Function):void;
		
		/**
		 * Retrieve post statuses.
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: String</br>
		 * <ul>
		 * <li>const string 'draft'</li>
		 * <li>const string 'pending'</li>
		 * <li>const string 'private'</li>
		 * <li>const string 'publish'</li>
		 * </ul>
		 */		
		function getPostStatusList(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Retrieve all of the WordPress supported page statuses. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: String</br>
		 * <ul>
		 * <li>const string 'draft'</li>
		 * <li>const string 'private'</li>
		 * <li>const string 'publish'</li>
		 * </ul>
		 */		
		function getPageStatusList(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Retrieve page templates.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Object (like a hashmap)
		 * <ul>
		 * <li>name:template name,key:page file name</li>
		 * <li>Default,"default"</li>
		 * </ul>
		 */		 	
		function getPageTemplates(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Retrieve blog options. If passing in an array, search for options listed within it. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param options Array
		 * element type: String</br>
		 * <ul>
		 * <li>string option</li>
		 * </ul>
		 * @param retFun
		 * element type: Object</br>
		 * <ul>
		 * <li>string key(enum:software_name|software_version|blog_url|time_zone|blog_title|blog_tagline|date_format|time_format)</li>
		 * <li>object value
		 * 	<ul>
		 * 		<li>string desc</li>
		 * 		<li>bool readonly</li>
		 * 		<li>string value</li>	
		 * 	</ul>
		 * </li>
		 * </ul>
		 */		
		function getOptions(blog_id:int,username:String,password:String,options:Array,retFun:Function):void;
	
		/**
		 * Update blog options. Returns array of structs showing updated values.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param options 
		 * <ul>
		 * <li>string key(enum:software_name|software_version|blog_url|time_zone|blog_title|blog_tagline|date_format|time_format)</li>
		 * <li>string value </li>
		 * </ul>
		 * @param retFun Object
		 * <ul>
		 * <li>string key(enum:software_name|software_version|blog_url|time_zone|blog_title|blog_tagline|date_format|time_format)</li>
		 * <li>object value
		 * 	<ul>
		 * 		<li>string desc</li>
		 * 		<li>bool readonly</li>
		 * 		<li>string value</li>	
		 * 	</ul>
		 * </li>
		 * </ul>
		 */		
		function setOptions(blog_id:int,username:String,password:String,options:Object,retFun:Function):void;
		
		/**
		 * Remove comment.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param comment_id 
		 * @param retFun boolean 
		 * 
		 */		
		function deleteComment(blog_id:int,username:String,password:String,comment_id:int,retFun:Function):void;
	
		/**
		 * Edit comment.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param comment_id 
		 * @param comment 
		 * <ul>
		 * <li>string comment_status </li>
		 * <li>date date_created_gmt</li>
		 * <li>string content </li>
		 * <li>string author</li>
		 * <li>string author_url </li>
		 * <li>string author_email </li>
		 * </ul>
		 * @param retFun boolean 
		 */			
		function editComment(blog_id:int,username:String,password:String,comment_id:int,comment:Object,retFun:Function):void;
		
		/**
		 * Create new comment. If you want to allow users to comment without auth,plz add filter "xmlrpc_allow_anonymous_comments"; 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param post_id 
		 * @param comment  
		 * <ul>
		 * <li>int comment_parent</li>
		 * <li>string content </li>
		 * <li>string author</li>
		 * <li>string author_url </li>
		 * <li>string author_email </li>
		 * </ul>
		 * @param retFun int comment_id
		 */		
		function newComment(blog_id:int,username:String,password:String,post_id:int,comment:Object,retFun:Function):void
	
		/**
		 * Retrieve all of the comment status. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Object
		 * <ul>
		 * <li>string key(enum:approve|hold|spam)</li>
		 * <li>string value</li>
		 * </ul>
		 */		
		function getCommentStatusList(blog_id:int,username:String,password:String,retFun:Function):void;
	
		/**
		 * Get the page identified by the page id.  
		 * @param blog_id 
		 * @param page_id  
		 * @param username 
		 * @param password 
		 * @param retFun Object
		 * <ul>
		 * <li>datetime dateCreated (ISO.8601) </li>
		 * <li>int userid </li>
		 * <li>int page_id </li>
		 * <li>string page_status </li>
		 * <li>string description </li>
		 * <li>string title</li>
		 * <li>string link </li>
		 * <li>string permaLink </li>
		 * <li>array categories(String)
		 * 	<ul>
		 * 		<li>string Category Name</li>
		 * 	</ul>
		 * </li>
		 * <li>string excerpt</li>
		 * <li>string text_more</li>
		 * <li>int mt_allow_comments</li>
		 * <li>int mt_allow_pings</li>
		 * <li>string wp_slug </li>
		 * <li>string wp_password </li>
		 * <li>string wp_author</li>
		 * <li>int wp_page_parent_id </li>
		 * <li>string wp_page_parent_title </li>
		 * <li>int wp_page_order</li>
		 * <li>int wp_author_id </li>
		 * <li>string wp_author_display_name</li>
		 * <li>array custom_fields(Object) 
		 * 	<ul>
		 * 		<li>string id </li>
		 * 		<li>string key </li>
		 * 		<li>string value </li>
		 *	</ul>
		 * </li>
		 * <li>string wp_page_template</li>
		 * </ul>
		 */		
		function getPage(blog_id:int,page_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Get an array of all the pages on a blog.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type same as getPage()
		 * @see getPage()
		 */		
		function getPages(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Get an array of all the pages on a blog. Just the minimum details, lighter than getPages() @see getPages() 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>int page_id </li>
		 * <li>string page_title</li>
		 * <li>int page_parent_id </li>
		 * <li>datetime dateCreated</li>
		 * </ul>
		 */		
		function getPageList(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Create a new page. Similar to metaWeblog.newPost. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param page 
		 * <ul>
		 * <li>string wp_slug</li>
		 * <li>string wp_password</li>
		 * <li>int wp_page_parent_id </li>
		 * <li>int wp_page_order </li>
		 * <li>int wp_author_id </li>
		 * <li>string title </li>
		 * <li>string description (content of post) </li>
		 * <li>string mt_excerpt </li>
		 * <li>string mt_text_more </li>
		 * <li>int mt_allow_comments (0 = closed, 1 = open) </li>
		 * <li>int mt_allow_pings (0 = closed, 1 = open) </li>
		 * <li>datetime dateCreated </li>
		 * <li>array custom_fields 
		 * 	<ul>
		 * 		<li>Same struct data as custom_fields in getPage()</li>	
		 * 	</ul>
		 * </li>
		 * <li>bool publish </li>
		 * </ul>
		 * @param retFun int(page_id)
		 * @see getPage()
		 */		
		function newPage(blog_id:int,username:String,password:String,page:Object,publish:Boolean,retFun:Function):void;
	
		/**
		 * Removes a page from the blog. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param page_id 
		 * @param retFun Boolean
		 */		
		function deletePage(blog_id:int,username:String,password:String,page_id:int,retFun:Function):void;
		
		/**
		 * Make changes to a blog page. 
		 * @param blog_id 
		 * @param page_id 
		 * @param username 
		 * @param password 
		 * @param content  #Same struct data as newPage()
		 * @param publish 
		 * @param retFun Boolean 
		 * @see newPage()
		 */		
		function editPage(blog_id:int,page_id:int,username:String,password:String,content:Object,publish:Boolean,retFun:Function):void;
		
		/**
		 * Get an array of users for the blog. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>int user_id</li>
		 * <li>string user_login</li>
		 * <li>string display_name</li>
		 * </ul>
		 */		
		function getAuthors(blog_id:int,username:String,password:String,retFun:Function):void;
		
		/**
		 * Get an array of available categories on a blog. 
		 * @param blog_id 
		 * @param username 
		 * @param password  
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>String categoryDescription</li>
		 * <li>int categoryId </li>
		 * <li>int parentId </li>
		 * <li>string description </li>
		 * <li>string categoryName </li>
		 * <li>string htmlUrl </li>
		 * <li>string rssUrl </li>
		 * </ul>
		 */		
		function getCategories(blog_id:int,username:String,password:String,retFun:Function):void;
	
		/**
		 * Create a new category. 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param category 
		 * <ul>
		 * <li>string name </li>
		 * <li>string slug </li>
		 * <li>int parent_id </li>
		 * <li>string description </li>
		 * </ul>
		 * @param retFun int(new category's id) 
		 */		
		function newCategory(blog_id:int,username:String,password:String,category:Object,retFun:Function):void;
	
		/**
		 * Delete a category.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param category_id 
		 * @param retFun Boolean
		 */		
		function deleteCategory(blog_id:int,username:String,password:String,category_id:int,retFun:Function):void;
		
		/**
		 * Get an array of categories that start with a given string.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param category 
		 * @param max_results 
		 * @param retFun Array
		 * element type: Object</br>
		 * <ul>
		 * <li>int categoryId </li>
		 * <li>string category_name </li>
		 * </ul>
		 */		
		function suggestCategories(blog_id:int,username:String,password:String,category:String,max_results:int,retFun:Function):void;
	
		/**
		 * Upload a file.  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param data 
		 * <ul>
		 * <li>string name </li>
		 * <li>string type  </li>
		 * <li>base64 bits </li>
		 * <li>bool overwrite </li>
		 * </ul>
		 * @param retFun Object
		 * <ul>
		 * <li>string file </li>
		 * <li>string url </li>
		 * <li>string type </li>
		 * </ul>
		 */			
		function uploadFile(blog_id:int,username:String,password:String,data:Object,retFun:Function):void;
	
		/**
		 * Gets a comment, given it's comment ID. Note that this isn't in 2.6.1, but is in the HEAD (so should be in anything newer than 2.6.1)  
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param comment_id 
		 * @param retFun Object
		 * <ul>
		 * <li>datetime date_created_gmt (ISO.8601, always GMT) </li>
		 * <li>string user_id </li>
		 * <li>string comment_id </li>
		 * <li>string parent </li>
		 * <li>string status </li>
		 * <li>string content </li>
		 * <li>string link </li>
		 * <li>string post_id </li>
		 * <li>string post_title </li>
		 * <li>string author </li>
		 * <li>string author_url </li>
		 * <li>string author_email </li>
		 * <li>string author_ip </li>
		 * <li>string type</li>
		 * </ul>
		 */		
		function getComment(blog_id:int,username:String,password:String,comment_id:int,retFun:Function):void;
	
		/**
		 * Gets a set of comments for a given post. Note that this isn't in 2.6.1, but is in the HEAD (so should be in anything newer than 2.6.1). 
		 * @param blog_id 
		 * @param username 
		 * @param password 
		 * @param struct 
		 * <ul>
		 * <li>int post_id </li>
		 * <li>string status (approve is good. blank means ALL)</li>
		 * <li>int offset</li>
		 * <li>int number </li>
		 * </ul>
		 * @param retFun Array #Returns an array of the comment structure same as getComment()
		 * @see getComment()
		 */		
		function getComments(blog_id:int,username:String,password:String,struct:Object,retFun:Function):void;
	}
}